<template>
  <div>
    <div class="orderdetails-state">
      <dl>
        <dt><i class="iconfont icon-dingdan"></i></dt>
        <dd id="order-state">
          <h2><font>{{orderDetailver.refund_text}}</font>
          </h2>
          <h3>
            <p>{{orderDetailver.refund_status_tip}}</p>
          </h3>
        </dd>
      </dl>
    </div>

    <div class="orderdetails-state">
      <p>{{orderDetailver.refund_illustration}}</p>
    </div>

    <div class="order-list-box">
      <div class="orderList">
        <div class="order-list-num">
          <p>退款单号：{{orderDetailver.refund_id}}</p>
          <p>申请时间：<font>{{submitTime}}</font></p>
          <p>退款金额：<b class="red45">¥{{pricesTotal}}</b></p>
          <span class="copyBtn" @click="copyTBL">复制</span>
        </div>
      </div>
    </div>
    <div class="refund-btn" @click="toOrderDetails(orderDetailver.order_no)">查看订单详情</div>
  </div>
</template>

<script>
import { formatTime } from '@/utils/index'
export default {
  data() {
    return {
      pricesTotal:'',
      orderDetailver: [],
      submitTime: ''
    }
  },
  onLoad() {
    this.$wx.setTitleBarTitle('退款详情');
    this.getdata()
  },
  onShow(){
    
  },
  computed: {
  },
  methods: {
    async getdata() {
      const data = await this.$fly.post(this.$url.URL_REFUNDINFO, {
        refund_id: this.$root.$mp.query.refundId
      })
      if (data.successCode === 1) {
        this.orderDetailver = data.data.refund_detail
        this.submitTime = formatTime(new Date(this.orderDetailver.refund_time * 1000));
        this.pricesTotal = this.orderDetailver.prices.total
      } else {
        this.$wx.showShortToast(data.message)
      }
    },
    toOrderDetails(orderNo){
      this.$wx.jumper('/pages/orderDetails/main?orderNo='+ orderNo)
    },
    copyTBL: function(e) {
      var self = this
      wx.setClipboardData({
        data: self.orderDetailver.refund_id.toString(),
        success: function(res) {
          self.$wx.showLongToast('复制成功')
        }
      })
    }
  }
}
</script>

<style scoped>
</style>
